package cn.harry.modular.achievement.service.impl;

import cn.harry.modular.achievement.enums.NoticeTypeEnums;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.harry.modular.achievement.mapper.NoticeMapper;
import cn.harry.modular.achievement.service.NoticeService;
import cn.harry.modular.achievement.domain.Notice;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;

/**
 * 消息通知服务实现类
 *
 * @author harry
 * @公众号 Harry技术
 */
@Service
@RequiredArgsConstructor
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements NoticeService {

    @Override
    public void saveInfo(Long userId, String content, NoticeTypeEnums noticeTypeEnums) {
        Notice notice = new Notice();
        notice.setTitle(noticeTypeEnums.getDesc());
        notice.setContent(content);
        notice.setType(noticeTypeEnums.getCode());
        notice.setUserId(userId);
        save(notice);
    }
}
